<?php

/**
 * This is the model class for table "pemakaian_meetingroom".
 *
 * The followings are the available columns in table 'pemakaian_meetingroom':
 * @property string $id_pemakaian_meetingroom
 * @property string $mulai
 * @property string $akhir
 * @property string $keterangan
 * @property string $id_meetingroom
 * @property string $id_pegawai
 *
 * The followings are the available model relations:
 * @property MstMeetingroom $idMeetingroom
 * @property MstPegawai $idPegawai
 */
class PemakaianMeetingroom extends CActiveRecord
{
    
        
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return PemakaianMeetingroom the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'pemakaian_meetingroom';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('mulai, akhir, keterangan, id_meetingroom, id_pegawai', 'required'),
			array('id_meetingroom, id_pegawai', 'length', 'max'=>20),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id_pemakaian_meetingroom, mulai, akhir, keterangan, id_meetingroom, id_pegawai', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'Meetingroom' => array(self::BELONGS_TO, 'Meetingroom', 'id_meetingroom'),
			'Pegawai' => array(self::BELONGS_TO, 'Pegawai', 'id_pegawai'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id_pemakaian_meetingroom' => 'Id Pemakaian Meetingroom',
			'mulai' => 'Mulai',
			'akhir' => 'Akhir',
			'keterangan' => 'Keterangan',
			'id_meetingroom' => 'Id Meetingroom',
			'id_pegawai' => 'Id Pegawai',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id_pemakaian_meetingroom',$this->id_pemakaian_meetingroom,true);
		$criteria->compare('mulai',$this->mulai,true);
		$criteria->compare('akhir',$this->akhir,true);
		$criteria->compare('keterangan',$this->keterangan,true);
		$criteria->compare('id_meetingroom',$this->id_meetingroom,true);
		$criteria->compare('id_pegawai',$this->id_pegawai,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}